﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="LogList.aspx.cs" Inherits="Medianamik.UI.ConfigManagement.LogList" MasterPageFile="/Medianamik/MasterPages/MedianamikModule.Master" %>

<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeaderContentHolder" runat="server">
<style type="text/css">
    table.Search
    {
        margin-bottom:10px;
    }
    
    table.Search tr td.SearchCell
    {
        padding-left:10px;
        padding-right:10px;
        border-left:1px solid #ccc;
    }
</style>
</asp:Content> 

<asp:Content ID="ContextMenuContent" ContentPlaceHolderID="ContextMenu" runat="server">
    <asp:HyperLink ID="lnkPurgeLogs" runat="server" Target="purgeLogsWindow" class="Action BtSupprimer" NavigateUrl="/medianamik/modalwindows/PurgeLogsWindow.aspx" onclick="GetRadWindowManager().Open(null, 'purgeLogsWindow');" Text="<%$ Resources: Medianamik_ConfigurationManagement,PurgeLogs %>" />
</asp:Content>

<asp:Content ID="CenterContent" ContentPlaceHolderID="CenterContent" runat="server">
    <asp:UpdatePanel runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
        <ContentTemplate>
            <fieldset>
                <h3><asp:Literal runat="server" Text="<%$ Resources: Medianamik_Global, SearchBox_SearchLabel %>" /></h3>
                <table class="Search">
                    <tr>
                        <td class="SearchCell" style="border-left-width:0;">
                            <asp:Label runat="server" AssociatedControlID="ddlLogType" Text="<%$ Resources : Medianamik_ConfigurationManagement, LogType %>"></asp:Label>
                            <asp:DropDownList CssClass="SelectList" ID="ddlLogType" runat="server" OnSelectedIndexChanged="RefreshGrid" AutoPostBack="true" />
                        </td>
                        <td class="SearchCell">
                            <asp:Label runat="server" AssociatedControlID="datBegins" Text="<%$ Resources : Medianamik_ConfigurationManagement, LogDateBegins %>"></asp:Label>
                            <telerik:RadDatePicker ID="datBegins" runat="server"  OnSelectedDateChanged="RefreshGrid" AutoPostBack="true" />
                        </td>
                        <td class="SearchCell" style="border-left-width:0;">
                            <asp:Label runat="server" AssociatedControlID="datEnds" Text="<%$ Resources : Medianamik_ConfigurationManagement, LogDateEnds %>"></asp:Label>
                            <telerik:RadDatePicker ID="datEnds" runat="server"  OnSelectedDateChanged="RefreshGrid" AutoPostBack="true" />
                        </td>
                        <td class="SearchCell">
                            <asp:Label runat="server" AssociatedControlID="tbMessage" Text="<%$ Resources : Medianamik_ConfigurationManagement, Message %>"></asp:Label>
                            <asp:TextBox ID="tbMessage" runat="server" OnTextChanged="RefreshGrid" AutoPostBack="true"></asp:TextBox>
                        </td>
                        <td class="SearchCell">
                            <asp:Button ID="btnRefreshGrid" runat="server" OnClick="RefreshGrid" Text='<%$ Resources : Medianamik_ConfigurationManagement, RefreshLogGrid %>' CssClass="Btn Inline" />
                        </td>
                        <td style="border-right-width:0;">
                            <asp:Button ID="btnResetSearch" runat="server" OnClick="ResetList" Text='<%$ Resources : Medianamik_Global, Reset %>' CssClass="Btn Inline" />
                        </td>
                    </tr>
                </table>
            </fieldset>
            <telerik:RadGrid ID="LogGrid"
                             runat="server"
                             AutoGenerateColumns="false"
                             AllowSorting="true"
                             OnNeedDataSource="LogGrid_NeedDataSource"
                             Skin="Medianamik"
                             EnableEmbeddedSkins="false"
                             AllowPaging="true"
                             PageSize="20"
                             PagerStyle-Mode="NextPrevAndNumeric"
                             PagerStyle-ShowPagerText="false"
                             PagerStyle-Position="TopAndBottom"
                             Width="100%"
                             OnItemDataBound="LogGrid_ItemDataBound"
                             OnPageIndexChanged="LogGrid_PageIndexChanged"
                             >
                <MasterTableView AllowMultiColumnSorting="false" AllowCustomSorting="true">
                    <Columns>
                        <telerik:GridTemplateColumn DataField="ObjectName" UniqueName="ObjectName" SortExpression="ObjectName" HeaderText="<%$ Resources : Medianamik_ConfigurationManagement, LogObjectName %>" ItemStyle-Width="25%">
                            <ItemTemplate>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="Type" SortExpression="Type" DataType="System.Int32" HeaderText="<%$ Resources : Medianamik_ConfigurationManagement, LogType %>">
                            <ItemTemplate>
                                <asp:Literal runat="server" Text='<%#TranslateType(DataBinder.Eval(Container.DataItem, "Type")) %>' />
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="LoggedOn" SortExpression="LoggedOn" HeaderText="<%$ Resources : Medianamik_ConfigurationManagement, LoggedOn %>"></telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn DataField="IP" HeaderText="IP" SortExpression="IP" ItemStyle-Width="10%">
                            <ItemTemplate>
                                <%#Eval("IP") %>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn DataField="UserAgent" HeaderText="User Agent" SortExpression="UserAgent" ItemStyle-Width="15%">
                            <ItemTemplate>
                                <acronym title="<%#Eval("UserAgent") %>"><%#Eval("ShortUserAgent") %></acronym>
                            </ItemTemplate>                        
                        </telerik:GridTemplateColumn>
                        <telerik:GridBoundColumn DataField="LoggedBy" HeaderText="<%$ Resources : Medianamik_ConfigurationManagement, Logger %>"></telerik:GridBoundColumn>
                        <telerik:GridTemplateColumn DataField="Message" SortExpression="Message" HeaderText="<%$ Resources : Medianamik_ConfigurationManagement, Message %>">
                            <ItemTemplate>
                                <asp:Label ID="Message" runat="server"></asp:Label>
                            </ItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
                    <NoRecordsTemplate>
			            <asp:Literal ID="NoRecords" runat="server" Text="<%$ Resources: Medianamik_ContentManagement, NoRecordsToDisplay %>" />
			        </NoRecordsTemplate>
                </MasterTableView>
            </telerik:RadGrid>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
<asp:Content ID="ExternalContent" ContentPlaceHolderID="ExternalContentHolder" runat="server">
    <telerik:RadScriptBlock runat="server" ID="scriptBlock">

        <script type="text/javascript">
            //<![CDATA[

            function modalWindowCallback(radWindow, returnValue)
            {
                if (returnValue) {
                    var argument = returnValue.get_argument();
                    if (argument && argument.value) {
                        __doPostBack('<%= Page.ClientID %>', '');
                    }
                }         
            }

            //]]>
        </script>

    </telerik:RadScriptBlock>
</asp:Content>


